package tec.stan.ling.topo.demo;

import org.xmappr.converters.ValueConverter;

import tec.stan.ling.core.top.model.Device;
import tec.stan.ling.topo.model.DeviceImpl;

public class DeviceConverter extends ValueConverter {

	@Override
	public Object fromValue(String value, String format, Class targetType,
			Object targetObject) {
		return null;
	}

	@Override
	public String toValue(Object object, String format) {
		if(object instanceof Device){
			return String.valueOf(((Device)object).getId());
		}
		return null;
	}

	@Override
	public boolean canConvert(Class type) {
		return type.equals(DeviceImpl.class) || type.equals(Device.class);
	}

}
